package com.example.demo.strategy;

/**
 * @author FENGYU
 * @description
 * @date 2023-12-09 10:23
 */
public class Main {
    public static void main(String[] args) {
        // 策略上下文
        Context context = new Context("add");
        // 加法策略
        System.out.println("10 + 5 = " + context.executeStrategy(10, 5));

        // 减法策略
        context = new Context("sub");
        System.out.println("10 - 5 = " + context.executeStrategy(10, 5));


        System.out.println(Thread.currentThread().getStackTrace()[1].getClassName());
    }
}
